<%@ page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ page import="com.gmail.avereshchaga.web.controller.EmployeeController"%>
<%@ page import="com.gmail.avereshchaga.web.controller.DivisionController"%>
<%@ page import="static com.gmail.avereshchaga.tools.Command.EMPLOYEE_CREATE_COMMAND"%>
<%@ page import="static com.gmail.avereshchaga.tools.UrlList.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <title>Create employee</title>
    </head>
    <body>
        <table class="loctable">
            <tr><td valign="top">
		<%@ include file="login.jsp" %> 
        <form:form commandName="<%=EMPLOYEE_CREATE_COMMAND %>" method="post">
        <table>
            <tr>
                <td><spring:message code="label.firstName"/>:</td>
                <td><form:input path="firstName" /></td>
                <td style="color:red;"><form:errors path="firstName" /></td> 
            </tr>
            <tr>
                <td><spring:message code="label.lastName"/>:</td>
                <td><form:input path="lastName" /></td>
                <td style="color:red;"><form:errors path="lastName" /></td> 
            </tr>
            <tr>
                <td><spring:message code="label.salary"/>:</td>
                <td><form:input path="salaryStr" /></td>
                <td style="color:red;"><form:errors path="salaryStr" /></td> 
            </tr>
            <tr>
                <td><spring:message code="label.birthdate"/>:</td>
                <td><form:input path="birthdateStr" /></td>
                <td style="color:red;"><form:errors path="birthdateStr" /></td>
            </tr>
	
            <tr>
            	<td><spring:message code="label.division"/>:</td>
            	<td>
            	<form:select path="divisionId">
            		<c:forEach items="${divisionList}" var="division">
              		  <option value="<c:out value="${division.id}"/>"><c:out value="${division.name}"/>
            		</c:forEach>
            	</form:select>
            	</td>
            </tr>
		</table> 
        <br />
				                
        <input type="submit" value="<spring:message code="label.save"/>" />
        <input onclick="history.back(-1)" value="<spring:message code="label.cancel"/>" type="button">
        </form:form>
        </td></tr>
        </table>
    </body>
</html>